<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<rich:panel header="#{messages['finance.management.menu']}">
	<h:panelGrid>
		<h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText>
	</h:panelGrid>
	
	<h:panelGrid width="100%">
	    <h:outputText value="#{messages['fin.inv.listing.title']}" styleClass="sub_header" />
	</h:panelGrid>
	
	<h:panelGrid width="100%" columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80">
		
		<h:panelGroup>
			<h:outputLabel value="#{messages['agreement.no.column']} :" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    <h:outputText value="#{memberInvListingBean.selectedMember.agreementNo}"></h:outputText>
		</h:panelGroup>
		
		<h:panelGroup>
			<h:outputLabel value="#{messages['membership.no.column']} :" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    <h:outputText value="#{memberInvListingBean.selectedMember.memberShipNo}"></h:outputText>
		</h:panelGroup>
		
		<h:panelGroup>
			<h:outputLabel value="#{messages['member.name.column']} :" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    <h:outputText value="#{memberInvListingBean.selectedMember.memberName}"></h:outputText>
		</h:panelGroup>
		
		<h:panelGroup>
			<h:outputLabel value="#{messages['member.status.column']} :" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    <h:outputText value="#{memberInvListingBean.selectedMember.memberStatus}"></h:outputText>
		</h:panelGroup>
		
		<h:panelGroup>
			<h:outputLabel value="#{messages['member.type.column']} :" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    <h:outputText value="#{memberInvListingBean.selectedMember.memberType}"></h:outputText>
		</h:panelGroup>	
	</h:panelGrid>
	
	<rich:spacer height="20" />
	
	<rich:dataTable id="data" var="inv" value="#{memberInvListingBean.invList}" rows="20" width="99%" >
		<rich:column style="text-align:left;width:20%;" >
			<f:facet name="header">
				<h:outputText value="#{messages['inv.no.column']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{inv.invNo}"></h:outputText>
		</rich:column>
		<rich:column style="text-align:left;width:20%;" >
			<f:facet name="header">
				<h:outputText value="#{messages['item.descn.column']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{inv.itemDescn}"></h:outputText>
		</rich:column>
		<rich:column style="text-align:left;">
			<f:facet name="header">
				<h:outputText value="#{messages['item.type.column']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{inv.itemType}"></h:outputText>
		</rich:column>
		<rich:column style="text-align:left;">
			<f:facet name="header">
				<h:outputText value="#{messages['inv.amt.column']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{inv.invAmt}">
				<f:convertNumber pattern="#0.00"/>
			</h:outputText>
		</rich:column>
		<rich:column style="text-align:left;">
			<f:facet name="header">
				<h:outputText value="#{messages['amt.paid.column']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{inv.amtPaid}">
				<f:convertNumber pattern="#0.00"/>
			</h:outputText>
		</rich:column>
		
		<f:facet name="footer">
			<rich:columnGroup>
				<rich:column style="text-align:left; background-color: white;" colspan="3">
					<h:outputText value=""></h:outputText>
				</rich:column>
				<rich:column style="text-align:left; background-color: white;">
					<h:outputText value="#{memberInvListingBean.totalInvAmt}">
						<f:convertNumber pattern="#0.00"/>
					</h:outputText>
				</rich:column>
				<rich:column style="text-align:left; background-color: white;">
					<h:outputText value="#{memberInvListingBean.totalPaidAmt}">
						<f:convertNumber pattern="#0.00"/>
					</h:outputText>
				</rich:column>
			</rich:columnGroup>
		</f:facet>
	</rich:dataTable>
	
	<rich:spacer height="10" />
	
	<h:panelGrid width="100%" columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80">
		<h:panelGroup>
			<h:outputLabel value="#{messages['advance.payment.label']} :" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    <h:outputText value="#{memberInvListingBean.advancePayment}"></h:outputText>
		</h:panelGroup>
	</h:panelGrid>
	
	<rich:spacer height="10" />
	
	<t:panelGrid columns="3">
   		<h:commandButton value="#{messages['new.invoice.button']}" styleClass="button" action="#{memberInvListingBean.newInvoiceAction}"></h:commandButton>
	    <h:commandButton value="#{messages['payment.button']}" styleClass="button" action="#{memberInvListingBean.newPaymentAction}"></h:commandButton>
	    <h:commandButton value="#{messages['credit.note.button']}" styleClass="button" action="#{memberInvListingBean.newCreditNoteAction}"></h:commandButton>
    </t:panelGrid>
	
	<rich:spacer height="10" />
	
	<rich:datascroller align="left"  for="data" maxPages="20" />
	
	<rich:spacer height="30" />
	
</rich:panel>
